public __gc class TunerControl //class for handling interactions with tuner mode
{
	public:
		TunerControl(System::Windows::Forms::Form * form, System::Resources::ResourceManager * resources,
			System::Windows::Forms::Label * welcomeLabel, System::Windows::Forms::Button * goToTuner,
			System::Windows::Forms::Button * goToMetronome); //contructor
		void hideSelect(); //hide components for note selection
		void showSelect(); //show components for note selection
		void hideGraphics(); //hide components for graphics
		void showGraphics(); //show components for graphics
		void loadMainMenu(System::Object *  sender, System::EventArgs *  e); //load the main menu

	private:
		//pointers to original main menu components
		System::Windows::Forms::Label *  welcomeLabel_;
		System::Windows::Forms::Button *  goToTunerButton_;
		System::Windows::Forms::Button *  goToMetronomeButton_;
		
		//tuner note selection components
		System::Windows::Forms::Button *  tunerBackButton_;
		System::Windows::Forms::Label *  tunerSettingsLabel_;
		System::Windows::Forms::GroupBox *  noteSelectBox_;
		System::Windows::Forms::RadioButton *  aButton_;
		System::Windows::Forms::RadioButton *  aSharpButton_;
		System::Windows::Forms::RadioButton *  bButton_;
		System::Windows::Forms::RadioButton *  fSharpButton_;
		System::Windows::Forms::RadioButton *  fButton_;
		System::Windows::Forms::RadioButton *  eButton_;
		System::Windows::Forms::RadioButton *  dSharpButton_;
		System::Windows::Forms::RadioButton *  dButton_;
		System::Windows::Forms::RadioButton *  cSharpButton_;
		System::Windows::Forms::RadioButton *  cButton_;
		System::Windows::Forms::RadioButton *  gSharpButton_;
		System::Windows::Forms::RadioButton *  gButton_;
		System::Windows::Forms::Label *  targetLabel_;
		System::Windows::Forms::Button *  startTunerButton_;
		
		//tuner graphics components
		System::Windows::Forms::Button *  backToTunerButton_;
		System::Windows::Forms::PictureBox *  graphics_;
		System::Windows::Forms::Label *  note1Label_;
		System::Windows::Forms::Label *  note2Label_;
		System::Windows::Forms::Label *  note3Label_;
		System::Windows::Forms::Label *  note4Label_;
		System::Windows::Forms::Label *  note5Label_;
		
		//thread information for collection of audio samples
		System::Threading::Thread *thread_;
		__delegate void DelegateThreadTask();
		
		//integers for note targets, set when note goal changes
		int note1Target_;
		int note2Target_;
		int note4Target_;
		int note5Target_;
		int noteGoal_;
		
		//globals for drawing pens
		System::Drawing::Pen * red_;
		System::Drawing::Pen * green_;
		
		//global for most recent frequency retrieved
		float freq_;
		//bool indicating whether tuner should be running
		bool shouldRun_;

		void goToGraphics(System::Object *  sender, System::EventArgs *  e); //on button click, load graphics
		void updateNoteLabels(); //update labels in graphics according to target note
		void drawGraphics(System::Object *  sender, System::Windows::Forms::PaintEventArgs *  e); //repaint function, called by refresh
		void backToTuner(System::Object *  sender, System::EventArgs *  e); //on button click, load note selection
		void getFrequency(); //get current audio frequency
		
		//methods for setting various target notes on button click
		void setC(System::Object *  sender, System::EventArgs *  e);
		void setCSharp(System::Object * sender, System::EventArgs * e);
		void setD(System::Object * sender, System::EventArgs * e);
		void setDSharp(System::Object * sender, System::EventArgs * e);
		void setE(System::Object * sender, System::EventArgs * e);
		void setF(System::Object * sender, System::EventArgs * e);
		void setFSharp(System::Object * sender, System::EventArgs * e);
		void setG(System::Object * sender, System::EventArgs * e);
		void setGSharp(System::Object * sender, System::EventArgs * e);
		void setA(System::Object * sender, System::EventArgs * e);
		void setASharp(System::Object * sender, System::EventArgs * e);
		void setB(System::Object * sender, System::EventArgs * e);
};